package kr.hkit.powerjava.chapter12.interfaceex;

public class Box implements Comparable {
	private double volume;

	public Box(double volume) {
		this.volume = volume;
	}

	@Override
	public int compareTo(Object other) {
		return (int) (this.volume - ((Box)other).volume);
	}
	
	public static void main(String[] args) {
		Box b1 = new Box (100);
		Box b2 = new Box (185.0);
	
		
		if (b1.compareTo(b2) > 0 ) {
			System.out.println("b1이 크다");
		}else if (b1.compareTo(b2) < 0) {
			System.out.println("b2가 크다");
		}else {
			System.out.println("b1과 b2는 같음.");
		}

	}
}
